import { createStore } from 'vuex';
import createPersistedState from 'vuex-persistedstate';

export default createStore({
	state: {
		isGetterRouter: false,
		isCollapsed: false,
	},
	getters: {},
	mutations: {
		/// 是否已经配置过动态路由
		changeIsGetterRouter(state, value) {
			state.isGetterRouter = value;
		},
		/// 是否折叠菜单栏
		changeIsCollapsed(state) {
			state.isCollapsed = !state.isCollapsed;
		},
	},
	actions: {},
	modules: {},
	plugins: [
		// 持久化
		createPersistedState({
			// 需要持久化的字段
			paths: ['isCollapsed'],
		}),
	],
});
